  package org.flhy.step.idcard.id15to18;

  import org.eclipse.swt.custom.CCombo;
  import org.eclipse.swt.events.FocusEvent;
  import org.eclipse.swt.events.FocusListener;
  import org.eclipse.swt.events.ModifyEvent;
  import org.eclipse.swt.events.ModifyListener;
  import org.eclipse.swt.graphics.Cursor;
  import org.eclipse.swt.layout.FormAttachment;
  import org.eclipse.swt.layout.FormData;
  import org.eclipse.swt.layout.FormLayout;
  import org.eclipse.swt.widgets.Button;
  import org.eclipse.swt.widgets.Control;
  import org.eclipse.swt.widgets.Display;
  import org.eclipse.swt.widgets.Event;
  import org.eclipse.swt.widgets.Label;
  import org.eclipse.swt.widgets.Listener;
  import org.eclipse.swt.widgets.Shell;
  import org.eclipse.swt.widgets.Text;
  import org.pentaho.di.core.Const;
  import org.pentaho.di.core.exception.KettleException;
  import org.pentaho.di.core.row.RowMetaInterface;
  import org.pentaho.di.i18n.BaseMessages;
  import org.pentaho.di.trans.TransMeta;
  import org.pentaho.di.trans.step.StepDialogInterface;
  import org.pentaho.di.ui.core.dialog.ErrorDialog;
  import org.pentaho.di.ui.core.widget.TextVar;
  import org.pentaho.di.ui.trans.step.BaseStepDialog;

  public class id15to18Dialog extends BaseStepDialog implements StepDialogInterface
  {
/*  33 */   private static Class<?> PKG = Id15to18Meta.class;
    private Id15to18Meta input;
    private Label wlFieldname;

    public id15to18Dialog(Shell parent, Object baseStepMeta, TransMeta transMeta, String stepname) {
/*  38 */     super(parent, (org.pentaho.di.trans.step.BaseStepMeta)baseStepMeta, transMeta, stepname);
/*  39 */     this.input = ((Id15to18Meta)baseStepMeta);
    }


    private CCombo wFieldname;

    private Label wlResultField;

    private TextVar wResultField;
    public String open()
    {
/*  50 */     Shell parent = getParent();
/*  51 */     Display display = parent.getDisplay();

/*  53 */     this.shell = new Shell(parent, 3312);
/*  54 */     this.props.setLook(this.shell);
/*  55 */     setShellImage(this.shell, this.input);

/*  57 */     ModifyListener lsMod = new ModifyListener() {
        public void modifyText(ModifyEvent e) {
/*  59 */         id15to18Dialog.this.input.setChanged();
        }
/*  61 */     };
/*  62 */     this.changed = this.input.hasChanged();

/*  64 */     FormLayout formLayout = new FormLayout();
/*  65 */     formLayout.marginWidth = 5;
/*  66 */     formLayout.marginHeight = 5;

/*  68 */     this.shell.setLayout(formLayout);
/*  69 */     this.shell.setText(BaseMessages.getString(PKG, "IdCard.name", new String[0]));

/*  71 */     int middle = this.props.getMiddlePct();
/*  72 */     int margin = 4;

/*  74 */     this.wlStepname = new Label(this.shell, 131072);
/*  75 */     this.wlStepname.setText(BaseMessages.getString(PKG, "System.Label.StepName", new String[0]));
/*  76 */     this.props.setLook(this.wlStepname);
/*  77 */     this.fdlStepname = new FormData();
/*  78 */     this.fdlStepname.left = new FormAttachment(0, 0);
/*  79 */     this.fdlStepname.right = new FormAttachment(middle, -margin);
/*  80 */     this.fdlStepname.top = new FormAttachment(0, margin);
/*  81 */     this.wlStepname.setLayoutData(this.fdlStepname);
/*  82 */     this.wStepname = new Text(this.shell, 18436);
/*  83 */     this.wStepname.setText(this.stepname);
/*  84 */     this.props.setLook(this.wStepname);
/*  85 */     this.wStepname.addModifyListener(lsMod);
/*  86 */     this.fdStepname = new FormData();
/*  87 */     this.fdStepname.left = new FormAttachment(middle, 0);
/*  88 */     this.fdStepname.top = new FormAttachment(0, margin);
/*  89 */     this.fdStepname.right = new FormAttachment(100, 0);
/*  90 */     this.wStepname.setLayoutData(this.fdStepname);
/*  91 */     Control lastControl = this.wStepname;

/*  93 */     this.wlFieldname = new Label(this.shell, 131072);
/*  94 */     this.wlFieldname.setText(BaseMessages.getString(PKG, "idcard15to18.Dialog.IdCardField", new String[0]));
/*  95 */     this.props.setLook(this.wlFieldname);
/*  96 */     FormData fdlFieldname = new FormData();
/*  97 */     fdlFieldname.left = new FormAttachment(0, 0);
/*  98 */     fdlFieldname.right = new FormAttachment(middle, -margin);
/*  99 */     fdlFieldname.top = new FormAttachment(lastControl, margin);
/* 100 */     this.wlFieldname.setLayoutData(fdlFieldname);

/* 102 */     this.wFieldname = new CCombo(this.shell, 2056);
/* 103 */     this.props.setLook(this.wFieldname);
/* 104 */     this.wFieldname.addModifyListener(lsMod);
/* 105 */     FormData fdFieldname = new FormData();
/* 106 */     fdFieldname.left = new FormAttachment(middle, 0);
/* 107 */     fdFieldname.top = new FormAttachment(lastControl, margin);
/* 108 */     fdFieldname.right = new FormAttachment(100, 0);
/* 109 */     this.wFieldname.setLayoutData(fdFieldname);
/* 110 */     this.wFieldname.addFocusListener(new FocusListener()
      {
        public void focusLost(FocusEvent e) {}

        public void focusGained(FocusEvent e) {
/* 115 */         Cursor busy = new Cursor(id15to18Dialog.this.shell.getDisplay(), 1);
/* 116 */         id15to18Dialog.this.shell.setCursor(busy);
/* 117 */         id15to18Dialog.this.getFields();
/* 118 */         id15to18Dialog.this.shell.setCursor(null);
/* 119 */         busy.dispose();
        }
/* 121 */     });
/* 122 */     lastControl = this.wFieldname;

/* 124 */     this.wlResultField = new Label(this.shell, 131072);
/* 125 */     this.wlResultField.setText(BaseMessages.getString(PKG, "idcard15to18.Dialog.ResultField", new String[0]));
/* 126 */     this.props.setLook(this.wlResultField);
/* 127 */     FormData fdlLimit = new FormData();
/* 128 */     fdlLimit.left = new FormAttachment(0, 0);
/* 129 */     fdlLimit.right = new FormAttachment(middle, -margin);
/* 130 */     fdlLimit.top = new FormAttachment(lastControl, margin);
/* 131 */     this.wlResultField.setLayoutData(fdlLimit);
/* 132 */     this.wResultField = new TextVar(this.transMeta, this.shell, 18436);
/* 133 */     this.props.setLook(this.wResultField);
/* 134 */     this.wResultField.addModifyListener(lsMod);
/* 135 */     FormData fdLimit = new FormData();
/* 136 */     fdLimit.left = new FormAttachment(middle, 0);
/* 137 */     fdLimit.top = new FormAttachment(lastControl, margin);
/* 138 */     fdLimit.right = new FormAttachment(100, 0);
/* 139 */     this.wResultField.setLayoutData(fdLimit);
/* 140 */     lastControl = this.wResultField;

/* 142 */     this.wOK = new Button(this.shell, 8);
/* 143 */     this.wOK.setText(BaseMessages.getString(PKG, "System.Button.OK", new String[0]));
/* 144 */     this.wCancel = new Button(this.shell, 8);
/* 145 */     this.wCancel.setText(BaseMessages.getString(PKG, "System.Button.Cancel", new String[0]));

/* 147 */     setButtonPositions(new Button[] { this.wOK, this.wCancel }, margin, lastControl);


/* 150 */     this.lsCancel = new Listener() {
        public void handleEvent(Event e) {
/* 152 */         id15to18Dialog.this.cancel();
        }
/* 154 */     };
/* 155 */     this.lsOK = new Listener() {
        public void handleEvent(Event e) {
/* 157 */         id15to18Dialog.this.ok();
        }

/* 160 */     };
/* 161 */     this.wCancel.addListener(13, this.lsCancel);
/* 162 */     this.wOK.addListener(13, this.lsOK);

/* 164 */     setSize();
/* 165 */     getData();

/* 167 */     this.input.setChanged(this.changed);
/* 168 */     this.shell.open();

/* 170 */     while (!this.shell.isDisposed()) {
/* 171 */       if (!display.readAndDispatch()) {
/* 172 */         display.sleep();
        }
      }

/* 176 */     return null;
    }

/* 179 */   private boolean gotPreviousFields = false;

    private void getFields() {
/* 182 */     if (!this.gotPreviousFields) {
/* 183 */       this.gotPreviousFields = true;
        try {
/* 185 */         String fieldname = this.wFieldname.getText();

/* 187 */         this.wFieldname.removeAll();
/* 188 */         RowMetaInterface r = this.transMeta.getPrevStepFields(this.stepname);
/* 189 */         if (r != null) {
/* 190 */           this.wFieldname.setItems(r.getFieldNames());
/* 191 */           if (fieldname != null) {
/* 192 */             this.wFieldname.setText(fieldname);
            }
          }
        }
        catch (KettleException ke) {
/* 197 */         new ErrorDialog(this.shell, BaseMessages.getString(PKG, "ValueMapperDialog.FailedToGetFields.DialogTitle", new String[0]), BaseMessages.getString(PKG, "ValueMapperDialog.FailedToGetFields.DialogMessage", new String[0]), ke);
        }
      }
    }

    public void getData() {
/* 203 */     if (this.input.getFieldToUse() != null) {
/* 204 */       this.wFieldname.setText(this.input.getFieldToUse());
      }
/* 206 */     if (this.input.getResultField() != null) {
/* 207 */       this.wResultField.setText(this.input.getResultField());
      }
    }

    private void cancel() {
/* 212 */     this.stepname = null;
/* 213 */     this.input.setChanged(this.changed);
/* 214 */     dispose();
    }

    private void ok() {
/* 218 */     if (Const.isEmpty(this.wStepname.getText())) {
/* 219 */       return;
      }
/* 221 */     this.stepname = this.wStepname.getText();

/* 223 */     this.input.setFieldToUse(this.wFieldname.getText());
/* 224 */     this.input.setResultField(this.wResultField.getText());

/* 226 */     dispose();
    }
  }


/* Location:              C:\Users\Lenovo\Desktop\kettle-newsee-plugin-0.0.1-SNAPSHOT.zip!\org\flhy\step\idcard\id15to18\Id15to18Dialog.class
 * Java compiler version: 8 (52.0)
 * JD-Core Version:       0.7.1
 */